using System.Collections.Generic;
using Common;
using DAL;
using Model;

namespace BLL {
    public class DeskBLL {
        private DeskDAL _deskDal = DeskDAL.GetInstance();
        private DeskBLL() { }
        private static DeskBLL _instance;

        public static DeskBLL Instance {
            get {
                if (_instance == null) {
                    _instance = new DeskBLL();
                }
                return _instance;
            }
        }

        public List<Desk> QueryByRoomId(int roomId) {
            return _deskDal.SelectByRoomId(roomId);
        }

        public Result<Desk> UpdateDeskState(Desk desk) {
            return _deskDal.UpdateDeskState(desk) == 1 ? Result<Desk>.Ok() : Result<Desk>.Error();
        }

        public int QueryOrderIdByDeskId(Desk desk) {
            return _deskDal.SelectOrderId(desk);
        }
    }
}